﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using TSqlServer;

public partial class ajax_linkmanlist : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack)
        {
        }
        else
        {
            string sid = this.Session["ecrm_uid"].ToString();
            this.Response.Write(ListMans(sid));
            this.Response.End();
        }
    }

    private string ListMans(string uid)
    {
        string result = "<table id=\"alllinkman\" cellSpacing=\"1\" cellPadding=\"0\" width=\"98%\" align=\"center\" border=\"0\" class=\"tablesorter\">";
        result += "<thead>";
        result += "<tr height=26>";
        result += "<th width=40 align=left>序号</th>";
        result += "<th width=70 align=left>姓名</th>";
        result += "<th width=40 align=left>性别</th>";
        result += "<th align=center>公司</th>";
        result += "</tr>";
        result += "</thead>";

        int iRow = 1;
        result += "<tbody>";
        string sSql = "select uid,linkman,sex,companyabb from t_linkman where inman='" + uid + "' order by iid desc";
        TSqlDBReader myReader = new TSqlDBReader(sSql);
        while (myReader.FDataReader.Read())
        {
            result += "<tr height=26>";
            result += "<td width=40 align=center>" + iRow.ToString() + "</td>";
            result += "<td width=70><a href=\"javascript:;\" onclick=\"getlinkman('" + myReader.FDataReader.GetValue(0).ToString() + "')\">" + myReader.FDataReader.GetValue(1).ToString() + "</a></td>";
            result += "<td width=40 align=center>" + myReader.FDataReader.GetValue(2).ToString() + "</td>";
            result += "<td>" + myReader.FDataReader.GetValue(3).ToString() + "</td>";
            result += "</tr>";
            iRow++;
        }
        myReader.Free();
        result += "<tbody>";

        result += "</table>";

        return result;
    }
}
